package Reproductor;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.*;

/**
 *
 * @author Pablo
 */
public class FileChooser extends JFileChooser{
    
    static private String newline = "\n";
    private JTextArea log;
    private JFileChooser fc;
    private File archivo;

    public FileChooser() {  
        //Set up the file chooser.
        if (fc == null) {
            fc = new JFileChooser();
	    //Add a custom file filter and disable the default
	    //(Accept All) file filter.
            fc.setFileFilter(new ImageFilter());   
            fc.setAcceptAllFileFilterUsed(false);	   
        }
        //Show it.
        int returnVal = fc.showDialog(FileChooser.this,
                                      "Agregar Cancion");

        //Process the results.
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            archivo = fc.getSelectedFile();            
        } 
    }
            
    /**
     * Create the GUI and show it.  For thread safety,
     * this method should be invoked from the
     * event dispatch thread.
     */    
    
    public File getNameFile() {
        return archivo;
    }
    
    public long getTamañoFile() {
        return archivo.length();
    }
}
